How to add the Spotify Login Button to your iOS easily using a ViewController with a WebView.
Lets get started!
Next, create a new app by tapping the box.
![unnamed](https://iphtechnologies.com/wp-content/uploads/2022/06/unnamed.png)
![imag2](https://iphtechnologies.com/wp-content/uploads/2022/06/imag2.png)
After creating your App . You go to the dashboard of your app, go to EDIT SETTINGS
![imag3](https://iphtechnologies.com/wp-content/uploads/2022/06/imag3.png)
In the new window, add your website (if you have one), as Redirect URIs add the name of your app and at the end add :// , for this example is spotifysigninexample://, and lastly, in Bundle IDs add your Bundle Bundle Identifier and press SAVE
![imag4](https://iphtechnologies.com/wp-content/uploads/2022/06/imag4.png)
After filling all the information in the editing setting. You have show client id and client secret
![imag5](https://iphtechnologies.com/wp-content/uploads/2022/06/imag5.png)
Creating the Spotify Login Button UI On Welcome page
![imag6](https://iphtechnologies.com/wp-content/uploads/2022/06/imag6.png)
![imag7](https://iphtechnologies.com/wp-content/uploads/2022/06/imag7.png)
After Implementing above welcomeController code and run this code you to see welcome screen UI like this-
![Screen Shot 2022-06-13 at 11.56.09 AM](https://iphtechnologies.com/wp-content/uploads/2022/06/Screen-Shot-2022-06-13-at-11.56.09-AM.png)
Create a new swift file to put the AuthManager.swift file
Paste the following code inside.
![imge10](https://iphtechnologies.com/wp-content/uploads/2022/06/imge10.png)
And Replace clientId and redirectURI with Your.
Here, we use the scope user-read-email to get the user’s email address. You can see more about other scopes here(Documentation).
Here create New ViewController (AuthManager) step up authentication and following this code:-
![iamge11](https://iphtechnologies.com/wp-content/uploads/2022/06/iamge11.png)
![image12](https://iphtechnologies.com/wp-content/uploads/2022/06/image12.png)
Next, create a new CocoaTouch file AuthViewController.swift with a WebView and add webView delegate is WKNavigationDelegate and following this code
![image14](https://iphtechnologies.com/wp-content/uploads/2022/06/image14.png)
After implementing all the above code and go to final results click on sign button and go through the webview in look the signUp screen of Spotify webpage.
![Simulator Screen Shot - iPhone 11 Pro - 2022-06-13 at 12.19.24](https://iphtechnologies.com/wp-content/uploads/2022/06/Simulator-Screen-Shot-iPhone-11-Pro-2022-06-13-at-12.19.24.png)