Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- passport.use(
- new Strategy(
- {
- clientID: '<clientID>',
- clientSecret: '<ClientSecret>',
- callbackURL: 'http://myapp/authenticated'
- },
- (accessToken, refreshToken, profile, cb) => {
- return cb(null, profile);
- }
- )
- );
- this.config.app.get(
- '/login',
- passport.authenticate('github', {
- scope: [
- 'user',
- 'notifications',
- 'gist',
- 'repo',
- 'admin:org',
- 'admin:public_key',
- 'admin:repo_hook',
- 'admin:org_hook'
- ]
- })
- );
- this.config.app.get(
- '/authenticated',
- passport.authenticate('github', {
- successRedirect: '/home',
- failureRedirect: '/signin',
- session: false
- }),
- (req, res) => {
- res.redirect('/home');
- }
- );
- }
- public async login(username: string, password: string) {
- const httpOptions = {
- headers: new HttpHeaders({
- 'Content-Type': 'application/json'
- })
- };
- const result = await this.http
- .get<any>('/login', httpOptions)
- .toPromise();
- 404 https://github.com/login/oauth/authorize?response_type=code&redirect....
- Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://myapp' is therefore not allowed access.
- public async login(username: string, password: string) {
- window.open('/login', '_self');
Add Comment
Please, Sign In to add comment