Skip to content

Instantly share code, notes, and snippets.

@dangerdespain
Last active August 21, 2019 17:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangerdespain/5a4e4ac7b233409f844ce4c5d8be5f6a to your computer and use it in GitHub Desktop.
Save dangerdespain/5a4e4ac7b233409f844ce4c5d8be5f6a to your computer and use it in GitHub Desktop.
Basic Instagram Oauth Login Button
import {Component} from '@angular/core';
interface MyWindow extends Window {
myFunction(): void;
}
declare var window: MyWindow;
@Component({
selector: 'instagram-login',
template: ` <div>
<button class="btn btn-med btn-instagram" (click)="onInstagramLoginClick()">
Sign in with Instagram
<!--i class="fa fa-instagram fa-fw"></i>Sign in with Instagram-->
</button>
</div>`,
providers: [],
})
export class InstagramLoginButton {
constructor() {
}
onInstagramLoginClick() {
var clientId = 'fb53e7027a55451185df4ccb66d7f86a';
var redirectUri = 'http://local-dev.supervitus.io:8099/api/instaOauth';
var state = localStorage.getItem('LOCALFLUENCE_AUTH_TOKEN');
var responseType = 'code';
let url = `https://api.instagram.com/oauth/authorize/?client_id=${clientId}&redirect_uri=${redirectUri}&state=${state}&response_type=${responseType}`;
window.open(url);
}
}
@wzup
Copy link

wzup commented Aug 11, 2017

But where is the button? Where are classes?

class="btn btn-med btn-instagram"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment