<figure class="wp-block-video"></figure>



<p class="wp-block-paragraph"><strong>Apple Login</strong> à¸à¸·à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¸«à¸£à¸·à¸à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸à¹à¸à¸ SSO ( Single Sign On ) à¸à¸§à¸²à¸¡à¸«à¸¡à¸²à¸¢à¸à¸·à¸à¸à¸²à¸£à¹à¸à¹à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¸µà¸¢à¸§à¸à¸±à¸à¸à¸±à¸à¹à¸à¸¥à¸à¸à¸à¸£à¹à¸¡à¹à¸ à¹à¸à¸¥à¸à¸à¸à¸£à¹à¸¡à¸«à¸à¸¶à¹à¸à¹à¸à¸à¸²à¸£à¸¥à¸à¸à¸°à¹à¸à¸µà¸¢à¸à¹à¸à¹à¸à¸²à¸ à¹à¸à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸µà¹à¸à¹à¸à¸·à¸à¸à¸²à¸£à¹à¸à¹ Apple ID à¹à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¸«à¸£à¸·à¸à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸à¹à¸à¹à¸²à¹à¸à¹à¸à¸²à¸à¸à¸à¸à¸à¹à¹à¸§à¸£à¹à¸à¸·à¹à¸</p>



<p class="wp-block-paragraph">à¹à¸£à¸²à¸à¸°à¹à¸£à¸´à¹à¸¡à¹à¸«à¹à¸à¸à¸±à¸§à¹à¸¥à¸·à¸à¸à¹à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸ หรืà¸à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸ à¸à¸à¹à¸§à¹à¸à¹à¸à¸à¹ หรืภmobile application à¹à¸à¸¢à¹à¸à¹ Apple ID มาà¸à¸à¸¶à¹à¸à¹à¸£à¸·à¹à¸à¸¢ à¹à¸«à¸à¸¸à¸à¸¥à¸à¹à¹à¸à¸£à¸²à¸°à¸§à¹à¸² à¸à¸²à¸ Apple à¹à¸à¹à¹à¸à¸´à¹à¸¡à¸à¸à¹à¸à¸à¸à¹à¹à¸à¸à¸²à¸£à¸à¸³ Application à¸à¸¶à¹à¸à¹à¸«à¹à¸à¸£à¸´à¸à¸²à¸£à¸à¸µà¹ Apps Store à¸à¹à¸²à¹à¸à¸à¸à¸±à¹à¸à¸¡à¸µà¸à¸²à¸£à¹à¸à¹ Third Party à¹à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸ à¹à¸à¹à¸ Facebook, Twitter หรืภGoogle à¹à¸à¸à¸à¸±à¹à¸à¸à¸³à¹à¸à¹à¸à¸à¹à¸à¸à¹à¸à¸´à¹à¸¡à¸à¸²à¸£à¹à¸à¹à¸²à¹à¸à¹à¸à¸²à¸à¸«à¸£à¸·à¸à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸à¸à¹à¸§à¸¢ Apple ID à¹à¸à¹à¸²à¹à¸à¸à¹à¸§à¸¢ ยà¸à¹à¸§à¹à¸à¹à¸à¹à¸§à¹à¸²à¹à¸à¸à¸à¸±à¹à¸à¹à¸à¹à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸£à¸°à¸à¸à¸«à¸£à¸·à¸à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸à¸à¹à¸§à¸¢ Custom Register à¸à¹à¹à¸¡à¹à¸à¸³à¹à¸à¹à¸à¸à¹à¸à¸à¹à¸à¸´à¹à¸¡à¸à¸²à¸£à¸ªà¸¡à¸±à¸à¸£à¸ªà¸¡à¸²à¸à¸´à¸à¸à¹à¸§à¸¢ Apple ID</p>



<h2 class="wp-block-heading"><strong>วิà¸à¸µà¸à¸³ Apple Login สำหรัภWebsite</strong> ( à¸à¸±à¹à¸à¸à¹à¸²à¸à¸±à¹à¸ Apple )</h2>



<ul class="wp-block-list"><li>à¸à¸³à¸à¸§à¸²à¸¡à¹à¸à¹à¸²à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¸à¸²à¸£à¸à¸±à¹à¸à¸à¹à¸²à¸à¸±à¹à¸ Apple à¹à¸à¸¢à¸£à¸§à¸¡ ยัà¸à¹à¸¡à¹à¹à¸à¹à¹à¸à¸µà¹à¸¢à¸§à¸à¸±à¸à¸à¸±à¹à¸ Website à¸à¸°à¸à¸£à¸±à¸ à¸à¸°à¸¡à¸µà¸à¸¢à¸¹à¹ 4 à¸à¸±à¹à¸à¸à¸à¸à¸«à¸¥à¸±à¸ ๠à¸à¸·à¸ <ul><li><strong>Enable App ID</strong></li><li><strong>Create Service ID for Web Authentication</strong></li><li><strong>Create Key</strong></li><li><strong>Register Email Sources for Communication</strong></li></ul></li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/0-940x119.png" alt="" class="wp-image-5256" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/0.png" data-full-size="2314x294" /></figure>



<p class="wp-block-paragraph"><strong>à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 1 Enable App ID</strong></p>



<ul class="wp-block-list"><li>à¹à¸à¹à¸à¸à¸à¸à¸£à¸±à¸à¸à¸¸à¸à¸à¹à¸à¸à¹à¸à¹à¸à¸ªà¸¡à¸²à¸à¸´à¸ <a rel="noreferrer noopener" href="https://developer.apple.com/programs" target="_blank">apple developer program</a> à¸à¹à¸à¸ à¸à¸¶à¹à¸à¸¡à¸µà¸à¹à¸²à¹à¸à¹à¸à¹à¸²à¸¢ 99$ à¸à¹à¸à¸à¸µ à¹à¸à¹à¹à¸à¹à¸à¸±à¹à¸à¹à¸à¸ Individual ( à¸à¸¸à¸à¸à¸¥ ) à¹à¸¥à¸° Enterprise ( à¸à¸´à¸à¸´à¸à¸¸à¸à¸à¸¥​ ) สมัà¸à¸£à¹à¸à¹à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/programs" target="_blank">https://developer.apple.com/programs</a></li></ul>



<ul class="wp-block-list"><li>สรà¹à¸²à¸ <strong>Primary App IDs</strong> à¹à¸à¹à¸²à¹à¸à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/account/resources/identifiers" target="_blank">Certificates, Identifiers &; Profiles </a> à¹à¸¥à¸·à¸à¸à¹à¸à¸à¸µà¹ <strong>Identifiers</strong> à¸à¸ + à¹à¸à¸·à¹à¸à¹à¸à¸´à¹à¸¡ <strong>App IDs</strong> à¹à¸«à¹à¹à¸¥à¸·à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸²à¸¡à¸ าà¸à¸à¹à¸²à¸à¸¥à¹à¸²à¸à¸à¸°à¸à¸£à¸±à¸</li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/1-940x519.png" alt="" class="wp-image-5249" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/1.png" data-full-size="1518x838" /><figcaption>à¹à¸¥à¸·à¸à¸à¸à¸µà¹ Apps IDs à¹à¸à¸·à¹à¸à¸ªà¸£à¹à¸²à¸ Primary App IDs à¸à¹à¸à¸</figcaption></figure>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/2-940x628.png" alt="" class="wp-image-5250" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/2.png" data-full-size="1260x842" /><figcaption>à¹à¸¥à¸·à¸à¸ Type à¹à¸à¹à¸ App</figcaption></figure>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/3-940x228.png" alt="" class="wp-image-5251" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/3.png" data-full-size="1988x482" /><figcaption>à¸à¸£à¸à¸ Description à¹à¸¥à¸° Bundle ID Explicit à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¹à¸à¹à¸ com.domain.appname à¸à¸´à¹à¸à¸à¸µà¹ Sign In with Apple à¹à¸¥à¸°à¸à¸ Edit</figcaption></figure>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/5-940x360.png" alt="" class="wp-image-5252" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/5.png" data-full-size="1332x510" /><figcaption>à¹à¸¥à¸·à¸à¸à¸à¸µà¹ Enable as a primary App ID à¸à¸ Save à¹à¸¥à¸° à¸à¸ Continue</figcaption></figure>



<p class="wp-block-paragraph"><strong>à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 2 Create Service ID for Web Authentication</strong></p>



<ul class="wp-block-list"><li>สรà¹à¸²à¸ <strong>Service IDs</strong> à¹à¸«à¹à¹à¸à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/account/resources/identifiers" target="_blank">Certificates, Identifiers &; Profiles</a> à¹à¸¥à¸·à¸à¸ <strong>Identifiers</strong> à¸à¸à¸à¸¸à¹à¸¡à¸à¸§à¸à¹à¸«à¸¡à¸·à¸à¸à¹à¸à¸´à¸¡ à¹à¸à¹à¸à¸£à¸²à¸§à¸à¸µà¹à¹à¸«à¹à¹à¸¥à¸·à¸à¸ à¸à¸µà¹ <strong>Services IDs</strong> à¸à¸²à¸à¸à¸±à¹à¸à¸à¸£à¸à¸à¹à¸à¸¡à¸¹à¸¥ description à¹à¸¥à¸° identifiers à¸à¸µà¹à¹à¸à¸à¸à¹à¸²à¸à¸à¸²à¸à¸à¸µà¹à¹à¸£à¸²à¸à¸£à¸à¸à¹à¸§à¹à¸à¹à¸à¸à¸«à¸à¹à¸²à¸à¸µà¹à¸à¸°à¸à¸£à¸±à¸ à¸à¸à¸¥à¸° app id à¸à¸±à¸ à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¹à¸à¹à¸ com.domain.login à¸à¸²à¸à¸à¸±à¹à¸à¸à¸ continue à¹à¸¥à¸° register à¸à¸²à¸¡à¸¥à¸³à¸à¸±à¸ </li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/6-940x529.png" alt="" class="wp-image-5258" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/6.png" data-full-size="1502x846" /></figure>



<ul class="wp-block-list"><li>หลัà¸à¸à¸²à¸à¸à¸ register à¹à¸£à¸µà¸¢à¸à¸£à¹à¸à¸¢à¹à¸¥à¹à¸§ ระà¸à¸à¸à¸°à¸à¸²à¹à¸£à¸²à¸¡à¸²à¸à¸µà¹à¸«à¸à¹à¸²à¹à¸ªà¸à¸ รายà¸à¸²à¸£ Services IDs à¹à¸«à¹à¹à¸£à¸²à¸à¸¥à¸´à¸à¹à¸à¸à¸µà¹ Services IDs à¸à¸µà¹à¹à¸£à¸²à¹à¸à¸´à¹à¸à¸ªà¸£à¹à¸²à¸ à¸à¸´à¹à¸à¸à¸¹à¸à¸à¸µà¹ <strong>Sign in with Apps</strong> à¸à¸²à¸à¸à¸±à¹à¸à¹à¸¥à¸·à¸à¸ Primary App IDs à¸à¸µà¹à¹à¸£à¸²à¸ªà¸£à¹à¸²à¸à¹à¸§à¹à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¹à¸£à¸ ระà¸à¸¸à¹à¸à¹à¸¡à¸à¸à¸µà¹à¹à¸£à¸²à¸à¹à¸à¸à¸à¸²à¸£à¸à¸³à¸£à¸°à¸à¸ Apple Login à¹à¸à¹à¸ www.abc.com à¹à¸¡à¹à¸à¹à¸à¸à¸¡à¸µ https à¸à¸²à¸à¸à¸±à¹à¸à¸£à¸°à¸à¸¸ redirect url à¸à¸·à¸ url à¸à¸µà¹à¸à¸° return à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸¥à¸±à¸à¸¡à¸²à¹à¸«à¹à¹à¸£à¸² à¹à¸à¹à¸ https://www.abc.com/redirect_apple_url à¹à¸à¹à¸à¸à¹à¸ มี https à¹à¸à¹à¸¡à¸à¸à¸°à¸à¹à¸à¸ Support à¸à¸²à¸¡à¸£à¸²à¸¢à¸à¸²à¸£à¸à¹à¸²à¸à¸¥à¹à¸²à¸à¸à¹à¸§à¸¢à¸à¸°à¸à¸£à¸±à¸<ul><li>à¹à¸§à¹à¸à¹à¸à¸à¹à¹à¸£à¸²à¸à¹à¸à¸à¹à¸à¹à¸²à¸à¹à¸²à¸ https à¹à¸à¹à¸²à¸à¸±à¹à¸</li><li>à¹à¸¥à¸° à¸à¹à¸à¸à¹à¸à¹à¸ TLS 1.2 หรืà¸à¸ªà¸¹à¸à¸à¸§à¹à¸²à¹à¸à¹à¸²à¸à¸±à¹à¸</li></ul></li></ul>



<p class="wp-block-paragraph">วิà¸à¸µà¸à¸£à¸§à¸à¸ªà¸à¸à¸§à¹à¸²à¹à¸§à¹à¸à¹à¸à¸à¹à¹à¸£à¸²à¸£à¸à¸à¸£à¸±à¸ TLS 1.2 หรืà¸à¸à¹à¸²à¸§ à¹à¸«à¹à¹à¸à¸à¸µà¹ <a rel="noreferrer noopener" href="https://ssltools.digicert.com/checker/views/checkInstallation.jsp" target="_blank">à¸à¸£à¸§à¸à¸ªà¸à¸ TLS</a> à¸à¸´à¸¡à¸à¹ url à¹à¸à¹à¸²à¹à¸à¹à¸¥à¸°à¸à¸¹à¸à¸µà¹à¸ªà¹à¸§à¸ Server Configuration</p>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/7-940x456.png" alt="" class="wp-image-5259" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/7.png" data-full-size="1428x692" /></figure>



<p class="wp-block-paragraph"><strong>à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 3 Create Key</strong></p>



<p class="wp-block-paragraph">สรà¹à¸²à¸ <strong>Keys</strong> à¹à¸«à¹à¹à¸à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/account/resources/identifiers" target="_blank">Certificates, Identifiers &; Profiles</a> à¹à¸¥à¸·à¸à¸ <strong>Keys</strong> à¸à¸à¸à¸¸à¹à¸¡à¹à¸à¸£à¸·à¹à¸à¸à¸«à¸¡à¸²à¸¢à¸à¸§à¸ + à¸à¸±à¹à¸à¸à¸·à¹à¸ keys à¸à¸²à¸à¸à¸±à¹à¸à¸à¸´à¹à¸à¸à¸µà¹ Sign in with Apple à¸à¸ Configure à¹à¸¥à¸°à¹à¸¥à¸·à¸à¸ Primary App IDs à¸à¸µà¹à¹à¸à¸¢à¸ªà¸£à¹à¸²à¸à¹à¸§à¹à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¹à¸£à¸ à¸à¸ save ->; continue à¹à¸¥à¸° download à¸à¸²à¸¡à¸¥à¸³à¸à¸±à¸ à¹à¸à¹à¸à¸à¸±à¸à¹à¸ªà¸£à¹à¸à¸ªà¸´à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 3 Create Key</p>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/8-940x474.png" alt="" class="wp-image-5261" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/8.png" data-full-size="1522x768" /></figure>



<p class="wp-block-paragraph"><strong>à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 4 Register Email Sources for Communication</strong></p>



<ul class="wp-block-list"><li>à¹à¸«à¹à¹à¸à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/account/resources/identifiers" target="_blank">Certificates, Identifiers &; Profiles</a> à¹à¸¥à¸·à¸à¸ <strong>More</strong> à¸à¸à¸à¸¸à¹à¸¡ Configure à¹à¸¥à¸·à¸à¸à¹à¸à¸à¸µà¹ Setting à¹à¸¥à¸°à¸à¸´à¹à¸à¹à¸à¸´à¸à¹à¸à¹à¸à¸²à¸ <strong>Receive Sign in with Apple private email relay notifications</strong> à¸à¸²à¸à¸à¸±à¹à¸à¸à¸ Save</li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/9-1-940x286.png" alt="" class="wp-image-5264" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/9-1.png" data-full-size="1142x348" /></figure>



<ul class="wp-block-list"><li>à¹à¸à¸ªà¹à¸§à¸à¸à¸à¸ Email Sources à¹à¸«à¹à¸à¸à¸à¸¸à¹à¸¡à¸à¸§à¸ + à¹à¸¥à¸°à¸£à¸°à¸à¸¸à¹à¸à¹à¸¡à¸à¸«à¸¥à¸±à¸ à¹à¸¥à¸° à¸à¸µà¹à¸¡à¸¥ à¸à¸²à¸¡à¸ าà¸à¸à¹à¸²à¸à¸¥à¹à¸²à¸ à¹à¸à¹à¸à¸à¸±à¸à¹à¸ªà¸£à¹à¸à¸ªà¸´à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¸ªà¸¸à¸à¸à¹à¸²à¸¢ <strong>Register Email Sources for Communication</strong> à¹à¸à¸ªà¹à¸§à¸à¸à¸²à¸£à¸à¸±à¹à¸à¸à¹à¸²à¹à¸à¹à¸à¸²à¸à¸à¸±à¹à¸ Apple</li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/10-940x908.png" alt="" class="wp-image-5265" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/10.png" data-full-size="1186x1146" /></figure>



<h2 class="wp-block-heading"><strong>วิà¸à¸µà¸à¸³ Apple Login สำหรัภWebsite</strong> ( à¸à¸±à¹à¸à¸à¹à¸²à¸à¸±à¹à¸ Website )</h2>



<ul class="wp-block-list"><li>à¸à¹à¸à¸à¸à¸³à¸à¸§à¸²à¸¡à¹à¸à¹à¸²à¹à¸à¸à¹à¸à¸à¸§à¹à¸²à¸à¸±à¹à¸à¹à¸§à¹à¸à¹à¸à¸à¹à¹à¸£à¸²à¸à¸°à¸¡à¸µà¸à¸¢à¸¹à¹ 2 url หลัภ๠à¸à¸·à¸<ul><li><strong>Login Page</strong> หà¸à¹à¸²à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¸à¸µà¹à¸¡à¸µà¸à¸¸à¹à¸¡ Sign in with Apple</li><li><strong>Callback Page</strong> สำหรัà¸à¸£à¸±à¸à¸à¹à¸à¸¡à¸¹à¸¥ หลัà¸à¸à¸²à¸à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸ à¹à¸¡à¹à¸§à¹à¸²à¸à¸°à¸ªà¸³à¹à¸£à¹à¸à¸«à¸£à¸·à¸à¹à¸¡à¹à¸ªà¸³à¹à¸£à¹à¸</li></ul></li></ul>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/11-940x487.png" alt="" class="wp-image-5266" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/11.png" data-full-size="1128x584" /><figcaption>à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸¸à¹à¸¡ Sign in with Apple</figcaption></figure>



<ul class="wp-block-list"><li>à¹à¸à¸«à¸à¹à¸² Login Page à¹à¸«à¹à¹à¸£à¸²à¸§à¸²à¸ javascript apple login à¹à¸§à¹à¹à¸¥à¸·à¸à¸ Tag à¸à¸´à¸ Body à¸à¸²à¸¡à¸à¹à¸²à¸à¸¥à¹à¸²à¸à¸à¸°à¸à¸£à¸±à¸</li></ul>



<pre class="wp-block-preformatted"><script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
<div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"></div>
<script type="text/javascript">
 AppleID.auth.init({
 clientId : '[CLIENT_ID]',
 scope : '[SCOPES]',
 redirectURI : '[REDIRECT_URI]',
 state : '[STATE]',
 });
</script></pre>



<ul class="wp-block-list"><li>à¸à¸à¸´à¸à¸²à¸¢ code à¹à¸à¸·à¹à¸à¸à¸à¹à¸à¸à¸°à¸à¸£à¸±à¸ สà¹à¸§à¸à¸à¸µà¹à¸à¸·à¸ à¸à¸²à¸£à¸à¸³ apple javascript api มาà¹à¸à¹à¸à¸²à¸à¸à¸à¹à¸§à¹à¸à¹à¸à¸à¹à¸à¸à¸à¹à¸£à¸²</li></ul>



<pre class="wp-block-preformatted"><script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script></pre>



<ul class="wp-block-list"><li>สà¹à¸§à¸à¸à¸µà¹à¸à¸·à¸ div à¸à¸¸à¹à¸¡à¸ªà¸µà¸à¸³ à¸à¸µà¹à¹à¸ªà¸à¸à¸à¸³à¸§à¹à¸² &#8216;Sign in with Apple&#8217; à¸à¸£à¹à¸à¸¡à¹à¸¥à¹à¸à¹ à¸à¸°à¹à¸à¸²à¹à¸à¸§à¸²à¸à¹à¸§à¹à¸ªà¹à¸§à¸à¹à¸«à¸à¹à¸à¸«à¸à¹à¸²à¹à¸§à¹à¸à¸à¹à¹à¸à¹ สามารà¸à¸à¸£à¸±à¸à¹à¸à¹à¸à¸à¸µà¹à¸à¸à¹à¹à¸à¹ à¹à¸«à¹à¹à¸à¹ css important à¸à¹à¸§à¸¢à¹à¸à¸à¸²à¸£à¸à¸£à¸±à¸ à¹à¸à¹à¹à¸«à¹à¸à¸¹ Guideline à¸à¸à¸à¸à¸²à¸ apple à¸à¹à¸§à¸¢ à¸à¸µà¹ <a rel="noreferrer noopener" href="https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple/overview/buttons/" target="_blank">human-interface-guidelines</a> </li></ul>



<pre class="wp-block-preformatted"><div id="appleid-signin" data-color="black" data-border="true" data-type="sign in"></div></pre>



<ul class="wp-block-list"><li>สà¹à¸§à¸à¸à¸à¸à¸à¸²à¸£ initzialize apple api à¸à¸°à¸¡à¸µ 4 à¸à¸²à¸£à¸²à¸¡à¸´à¹à¸à¸à¸£à¹à¸«à¸¥à¸±à¸ ๠à¸à¸µà¹à¸à¸³à¹à¸à¹à¸à¸à¹à¸à¸à¸£à¸°à¸à¸¸à¸à¸¢à¸¹à¹ 4 à¸à¸±à¸§à¸à¸°à¸à¸£à¸±à¸ à¹à¸¡à¹à¸£à¸°à¸à¸¸à¹à¸¡à¹à¹à¸à¹ <ul><li><strong>clientId</strong> à¸à¸·à¸ Services IDs à¸à¸µà¹à¹à¸£à¸²à¹à¸à¹à¸ªà¸£à¹à¸²à¸à¹à¸§à¹à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¸à¸µà¹ 2 ( à¹à¸¡à¹à¹à¸à¹ Primary ID ) à¹à¸à¹à¸ <strong>clientId : &#8216;com.domain.weblogin&#8217;</strong></li><li><strong>scope</strong> à¸à¸·à¸ à¸à¸³à¸à¸§à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¹à¸£à¸²à¸à¹à¸à¸à¸à¸²à¸£à¸à¸à¸à¸²à¸ apple api à¹à¸à¹à¸ <strong>scope : &#8216;name email&#8217;</strong> สัà¸à¹à¸à¸à¸¸à¸à¸°à¸à¸£à¸±à¸à¸§à¹à¸² apple à¸à¸°à¹à¸à¹ space à¹à¸à¸à¸²à¸£à¹à¸à¹à¸ scope à¹à¸¡à¹à¹à¸à¹ (,) à¹à¸«à¸¡à¸·à¸à¸ line หรืภfacebook</li><li><strong>redirectURI</strong> à¸à¸·à¸ callback url à¸à¸µà¹à¸à¸°à¸ªà¹à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸¥à¸±à¸à¸¡à¸²à¹à¸«à¹à¹à¸§à¹à¸à¹à¸à¸à¹à¹à¸£à¸² à¹à¸à¹à¸ <strong>redirectURI: &#8216;https://www.domain.com/apple_login&#8217;</strong> à¸à¸¢à¹à¸²à¸¥à¸·à¸¡à¸§à¹à¸²à¸à¹à¸à¸à¹à¸à¹à¸ https à¹à¸¥à¸° TLS 1.2 หรืà¸à¸ªà¸¹à¸à¸à¸§à¹à¸²à¹à¸à¹à¸²à¸à¸±à¹à¸ à¸à¸¶à¸à¸à¸°à¸£à¸à¸à¸£à¸±à¸</li><li><strong>state</strong> à¸à¸·à¸ id à¸à¹à¸à¸à¸£à¸±à¹à¸à¹à¸à¸à¸²à¸£à¸£à¹à¸à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥ à¸à¸¶à¹à¸à¹à¸£à¸²à¸à¸²à¸à¸°à¹à¸à¹à¹à¸à¹à¸ datetime à¸à¹à¹à¸à¹ à¹à¸à¹à¸ <strong>state : &#8216;<;?php echo time(&#8216;YmdHis&#8217;); ?>;&#8217;</strong></li></ul></li></ul>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript"><pre class="wp-block-preformatted">AppleID.auth.init({
 clientId : 'com.domain.weblogin',
 scope : 'name email',
 redirectURI: 'https://www.domain.com/apple_login',
 state : '<?php echo time('YmdHis'); ?>',
});</pre></code></pre>



<ul class="wp-block-list"><li>à¹à¸à¸µà¸¢à¸à¸à¸³à¸ªà¸±à¹à¸à¹à¸à¸·à¹à¸à¸£à¸±à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹ <strong>Callback Page</strong> หรืภredirectURL à¹à¸£à¸²à¸à¸°à¸ªà¸²à¸¡à¸²à¸£à¸à¸£à¸±à¸à¸à¹à¸² à¸à¸·à¹à¸ &#8211; à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥ à¸à¸µà¹à¸¡à¸¥ à¹à¸¥à¸°à¸à¸³à¹à¸à¹à¸à¹à¸à¸²à¸à¹à¸à¸à¸±à¹à¸à¸à¸à¸à¸à¹à¸à¹à¸ à¸à¸°à¹à¸à¸µà¸¢à¸ code รัà¸à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¹à¸à¸£à¸°à¸¡à¸²à¸à¸à¸µà¹à¸à¸°à¸à¸£à¸±à¸</li></ul>



<pre class="wp-block-code"><code lang="php" class="language-php">public function apple_login(){
 $post = $this->;input->;post();
 $user = json_decode($post['user']);
 $firstName = $user->;name->;firstName;
 $lastName = $user->;name->;lastName;
 $id_token = $post['id_token'];
}</code></pre>



<p class="wp-block-paragraph">à¹à¸£à¸²à¸à¸°à¹à¸à¹à¸à¸·à¹à¸ à¹à¸¥à¸° à¸à¸²à¸¡à¸ªà¸à¸¸à¸¥à¸¡à¸²à¹à¸à¸µà¸¢à¸à¹à¸à¹à¹à¸à¹ json_decode à¸à¸°à¸à¸£à¸±à¸ à¹à¸à¹à¸ªà¸³à¸«à¸£à¸±à¸à¸à¸µà¹à¸¡à¸¥ à¹à¸£à¸²à¸à¸°à¸à¹à¸à¸ <strong>JWT Decode</strong> à¸à¸±à¸§à¹à¸à¸£ id_token à¸à¸µà¸à¸à¸µ ( <a href="https://www.codebee.co.th/labs/วิà¸à¸µà¸à¸³-line-login/" target="_blank" rel="noreferrer noopener">ลัà¸à¸©à¸à¸°à¹à¸à¸µà¸¢à¸§à¸à¸±à¸à¸à¸±à¸ line login</a> )</p>



<h2 class="wp-block-heading">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¸à¸³à¸à¸²à¸ Sign in with Apple</h2>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/14-940x668.png" alt="" class="wp-image-5281" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/14.png" data-full-size="1120x796" /><figcaption>หลัà¸à¸à¸à¸à¸¸à¹à¸¡ &#8216;Sign in with Apple&#8217; à¸à¸°à¹à¸«à¹à¸à¸£à¸à¸ Apple ID à¸à¸±à¸ Password à¹à¸¥à¸°à¸à¸³ Two-factor Authentication à¹à¸à¸·à¹à¸à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸</figcaption></figure>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/12-940x439.png" alt="" class="wp-image-5277" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/12.png" data-full-size="2092x978" /><figcaption>หลัà¸à¸à¸²à¸à¸à¸³ Two-factor Authentication à¹à¸¥à¹à¸§à¸à¸°à¹à¸à¹à¸à¸£à¸²à¸¢à¸¥à¸°à¹à¸à¸µà¸¢à¸à¸£à¸°à¸à¸±à¸à¸à¸²à¸£à¹à¸à¹à¸²à¸à¸¶à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸£à¸°à¸¡à¸²à¸à¸à¸µà¹</figcaption></figure>



<figure class="wp-block-image size-large"><img src="https://www.codebee.co.th/labs/wp-content/uploads/2020/06/13-940x458.png" alt="" class="wp-image-5278" data-full="https://codebee.co.th/labs/wp-content/uploads/2020/06/13.png" data-full-size="2122x1034" /><figcaption>à¸à¸²à¸à¸à¸±à¹à¸à¸à¹à¸à¸°à¹à¸ªà¸à¸à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹ Website สามารà¸à¹à¸à¹à¸²à¸à¸¶à¸à¹à¸à¹ à¹à¸¥à¸°à¹à¸£à¸²à¸à¸°à¸à¸à¸¸à¸à¸²à¸à¸´à¸à¹à¸à¸¡à¸¹à¸¥à¸ªà¹à¸§à¸à¹à¸«à¸à¸à¹à¸²à¸</figcaption></figure>



<p class="wp-block-paragraph">หลัà¸à¸à¸à¸à¸¸à¹à¸¡ &#8216;<strong>continue</strong>&#8216; ระà¸à¸ apple api à¸à¸°à¸à¸²à¹à¸£à¸²à¹à¸à¸à¸µà¹à¸«à¸à¹à¸² redirectURI à¸à¸£à¹à¸à¸¡à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¸ post à¹à¸¡à¹à¸§à¹à¸²à¸à¸°à¹à¸à¹à¸²à¸ªà¸¹à¹à¸£à¸°à¸à¸à¸ªà¸³à¹à¸£à¹à¸à¸«à¸£à¸·à¸à¹à¸¡à¹à¸ªà¸³à¹à¸£à¹à¸ à¹à¸£à¸²à¸ªà¸²à¸¡à¸²à¸£à¸à¸à¸±à¸à¸à¸²à¸£à¸à¹à¸à¸¡à¸¹à¸¥à¹à¸à¹à¸à¸²à¸à¸à¸£à¸à¸à¸µà¹</p>

วิธีทำ Apple Login เข้าสู่ระบบด้วย Apple ID ( PHP ) บนเว็บไซต์

วิธีทำ-Apple-Login-เข้าสู่ระบบด้วย-Apple-ID-PHP-บนเว็บไซต์
