raulriera / authenticationviewcontroller Goto Github PK
View Code? Open in Web Editor NEWA simple to use, standard interface for authenticating to oauth 2.0 protected endpoints via SFSafariViewController.
License: MIT License
A simple to use, standard interface for authenticating to oauth 2.0 protected endpoints via SFSafariViewController.
License: MIT License
Here I share the connector for Google OAuth2 with an usage example (hope its help):
static let ClientId = "188766122934-0t21j64fd4qmcomewpho6jeqwxe6kpwq.apps.googleusercontent.com"
static let ClientSecret = "AIza34De1h2JIehyugxcgYnXewtokGdi0xXPsJMTY"
static let ScopeYoutubeReadonly = "https://www.googleapis.com/auth/youtube.readonly"
static let ScopeUserinfoEmail = "https://www.googleapis.com/auth/userinfo.email"
static let ScopeUserinfoProfile = "https://www.googleapis.com/auth/userinfo.profile"
let provider = OAuthGoogle(clientId: ServiceRequest.ClientId, clientSecret: "", scopes: [ServiceRequest.ScopeUserinfoEmail, ServiceRequest.ScopeUserinfoProfile, ServiceRequest.ScopeYoutubeReadonly])
let authenticationViewController = AuthenticationViewController(provider: provider)
authenticationViewController.failureHandler = { error in
print(error)
}
authenticationViewController.authenticationHandler = { token in
print (token)
authenticationViewController.dismiss(animated: true, completion: nil)
}
present(authenticationViewController, animated: true, completion: nil)
Does it work correctly fro Twitter/Facebook or Google+ ?
Can't manage any of them.
Can anyone provide an example with those networks?
e.g. I have following url for twitter:
"https://api.twitter.com/oauth/authorize/?client_id=\(clientId)&scope=\(scopes.joined(separator: "+"))&redirect_uri=(redirectURI)&response_type=code"
accessTokenURL = https://api.twitter.com/oauth/access_token"
redirectURI = "https://www.google.com"
Then, I put my ClientID and Secret, but nothing works. I can login and do not receive my token after switching to redirectURL.
Description for coub:
https://coub.com/dev/docs/Coub+API%2FAuthentication
If you need test credentials:
ID:
60b88af1e39803f5f68716bc364a498f9d4e733a7f76735dc48729e697de3bd6
Secret:
6f62d7366a58b07377a3046922d49c4f5ab882eebe322f50467856bb7b86e049
Redirect URL:
http://gargo.of.by
Permissions:
like+recoub
I used your example and added OAuthCoub
(looks like your OAuthDribble
and OAuthInstagram
) and called it. It seems everything ok with authorization - successfully logged in, and redirected to "Redirect URL". The only main trouble is application:openURL:options:
is not called at all and so I don't have a token in my app.
Could you please resolve this strange issue?
Maybe I should allow the user to close the window and include a new case to the AuthenticationError
to indicate when this happens
Has brought up by @edjiang on https://twitter.com/EdwardStarcraft/status/712727368788353024 which authentication flow should we use for this library?
Would love some feedback
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.